﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace University.Workshop.Business
{
    public static class ValidateCommands
    {
        static string lastCommand = "";
        static string lastCommand2 = "";
        public static string TranslateCommand(string command)
        {
            string result = "";
            switch (command)
            {
                case "user":
                    {
                        result = "usersToolStripMenuItem";
                        lastCommand = command;
                    } break;

                case "new":
                    {
                        if (lastCommand == "user")
                        {
                            result = "newUserToolStripMenuItem";
                            lastCommand = command;
                        }
                        else
                        {
                            if (lastCommand == "patient")
                            {
                                result = "newPatientToolStripMenuItem";
                                lastCommand = command;
                            }
                            else
                            {
                                if (lastCommand == "agenda")
                                {
                                    result = "newAppointmentToolStripMenuItem";
                                    lastCommand = command;
                                }
                                else
                                {
                                    if (lastCommand == "product")
                                    {
                                        result = "newProductToolStripMenuItem";
                                        lastCommand = command;
                                    }
                                }
                            }
                        }

                    } break;

                case "search":
                    {
                        if (lastCommand == "user")
                        {
                            result = "searchUserToolStripMenuItem";
                            lastCommand = command;
                        }
                        else
                        {
                            if (lastCommand == "patient")
                            {
                                result = "searchPatientToolStripMenuItem";
                                lastCommand = command;
                            }
                            else
                            {
                                if (lastCommand == "product")
                                {
                                    result = "searchProductToolStripMenuItem";
                                    lastCommand = command;
                                }
                            }
                        }

                    } break;

                case "today":
                    {
                        if (lastCommand == "agenda")
                        {
                            result = "todayAppointmentToolStripMenuItem";
                            lastCommand = command;
                        }
                    } break;

                case "logout"://logout->salir de la sesion
                    {
                        if (lastCommand == "system")
                        {
                            result = "exitSessionToolStripMenuItem";
                            lastCommand = command;
                        }

                    } break;

                case "change"://change ->password
                    {
                        if (lastCommand == "system")
                        {
                            result = "changePasswordToolStripMenuItem";
                            lastCommand = command;
                        }

                    } break;

                case "close"://Exit->cerrar programa
                    {
                        if (lastCommand == "system")
                        {
                            result = "exitAplicationToolStripMenuItem";
                            lastCommand = command;
                        }
                        else
                        {
                            result = "close";
                            lastCommand = command;
                        }

                    } break;

                case "roles"://Roles
                    {
                        if (lastCommand == "system")
                        {
                            result = "createAndEditRolesToolStripMenuItem";
                            lastCommand2 = "roles";
                        }
                        
                    } break;

                case "create":
                    {
                        if (lastCommand == "system")
                        {
                            if (lastCommand2 == "roles")
                            {
                                result = "createRoleToolStripMenuItem";
                                lastCommand = command;
                            }
                        }

                    } break;

                case "assign":
                    {
                        if (lastCommand == "system")
                        {
                            if (lastCommand2 == "roles")
                            {
                                result = "assignRoleToolStripMenuItem";
                                lastCommand = command;
                            }
                        }

                    } break;

                case "cancel":
                    {
                        result = "close";
                        lastCommand = command;

                    } break;

                case "patient":
                    {
                        result = "patientToolStripMenuItem";
                        lastCommand = command;

                    } break;

                case "agenda":
                    {
                        result = "agendaToolStripMenuItem";
                        lastCommand = command;
                    } break;

                case "product":
                    {
                        result = "productToolStripMenuItem";
                        lastCommand = command;
                    } break;

                case "system":
                    {
                        result = "sessionToolStripMenuItem";
                        lastCommand = command;
                    } break;

                case "cash":
                    {
                        result = "cashToolStripMenuItem";
                        lastCommand = command;
                    } break;

                case "payable":
                    {
                        if (lastCommand == "cash")
                        {
                            result = "jpderToolStripMenuItem";
                            lastCommand = command;
                        }

                    } break;

                case "receivable":
                    {
                        if (lastCommand == "cash")
                        {
                            result = "accountsReceivableToolStripMenuItem";
                            lastCommand = command;
                        }

                    } break;

                case "voice":
                    {
                        result = "voiceControlToolStripMenuItem";
                        lastCommand = command;
                    } break;

                case "enable":
                    {
                        if (lastCommand == "voice")
                        {
                            result = "enableToolStripMenuItem";
                            lastCommand = command;
                        }

                    } break;

                case "disable":
                    {
                        if (lastCommand == "voice")
                        {
                            result = "disableToolStripMenuItem";
                            lastCommand = command;
                        }

                    } break;
            }
            return result;
        }
    }
}
